/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Easy.table;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author DR.HUY
 */
@Entity
@Table(name = "Event", catalog = "EasyTicket", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "Event.findAll", query = "SELECT e FROM Event e"),
    @NamedQuery(name = "Event.findByEventID", query = "SELECT e FROM Event e WHERE e.eventID = :eventID"),
    @NamedQuery(name = "Event.findByEventName", query = "SELECT e FROM Event e WHERE e.eventName = :eventName"),
    @NamedQuery(name = "Event.findByDecripstion", query = "SELECT e FROM Event e WHERE e.decripstion = :decripstion"),
    @NamedQuery(name = "Event.findByDiscount", query = "SELECT e FROM Event e WHERE e.discount = :discount"),
    @NamedQuery(name = "Event.findByFromDate", query = "SELECT e FROM Event e WHERE e.fromDate = :fromDate"),
    @NamedQuery(name = "Event.findByToDate", query = "SELECT e FROM Event e WHERE e.toDate = :toDate"),
    @NamedQuery(name = "Event.findByStatus", query = "SELECT e FROM Event e WHERE e.status = :status")})
public class Event implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "EventID", nullable = false)
    private Integer eventID;
    @Basic(optional = false)
    @Column(name = "EventName", nullable = false, length = 500)
    private String eventName;
    @Basic(optional = false)
    @Column(name = "Decripstion", nullable = false, length = 500)
    private String decripstion;
    @Column(name = "Discount", length = 50)
    private String discount;
    @Column(name = "FromDate", length = 10)
    private String fromDate;
    @Column(name = "ToDate", length = 10)
    private String toDate;
    @Column(name = "Status", length = 10)
    private String status;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "event")
    private Collection<Ticket> ticketCollection;

    public Event() {
    }

    public Event(Integer eventID) {
        this.eventID = eventID;
    }

    public Event(Integer eventID, String eventName, String decripstion) {
        this.eventID = eventID;
        this.eventName = eventName;
        this.decripstion = decripstion;
    }

    public Integer getEventID() {
        return eventID;
    }

    public void setEventID(Integer eventID) {
        this.eventID = eventID;
    }

    public String getEventName() {
        return eventName;
    }

    public void setEventName(String eventName) {
        this.eventName = eventName;
    }

    public String getDecripstion() {
        return decripstion;
    }

    public void setDecripstion(String decripstion) {
        this.decripstion = decripstion;
    }

    public String getDiscount() {
        return discount;
    }

    public void setDiscount(String discount) {
        this.discount = discount;
    }

    public String getFromDate() {
        return fromDate;
    }

    public void setFromDate(String fromDate) {
        this.fromDate = fromDate;
    }

    public String getToDate() {
        return toDate;
    }

    public void setToDate(String toDate) {
        this.toDate = toDate;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Collection<Ticket> getTicketCollection() {
        return ticketCollection;
    }

    public void setTicketCollection(Collection<Ticket> ticketCollection) {
        this.ticketCollection = ticketCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (eventID != null ? eventID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Event)) {
            return false;
        }
        Event other = (Event) object;
        if ((this.eventID == null && other.eventID != null) || (this.eventID != null && !this.eventID.equals(other.eventID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Easy.table.Event[eventID=" + eventID + "]";
    }

}
